<template>
  <div class="boxto">
    <div v-for="(item,index) in list" :key="item.id" class="list_kr">
      <router-link :to="{ path: `/proDetail/${productId = 1}` }">
        <img width="100%" :src="item.img" alt="">
        <div>{{ item.title }}</div>
        <div v-if="item.describe">{{ item.describe }}</div>
        <div><span class="list_notes">{{ item.notes }}</span><span v-if="item.cheap" class="list_noto">{{ item.cheap
        }}</span></div>
        <div v-if="item.primary"><s class="list_boon">￥{{ item.primary }}</s></div>
        <div class="list_boto">
          <span class="red">￥{{ item.price }}<span class="black">/{{ item.unit }}</span></span>

        </div>
      </router-link>
      <van-badge v-if="nums[index].on>0" :content="nums[index].on" style="top: 0;right: 0;width: 16px;">
      
      </van-badge>
      <span class="list_borit" @click.self="los(nums[index])">+</span>
    </div>

  </div>
</template>

<script>

export default {
  props: {
    list: {
      type: Array,
      default: () => []
    }
  },
  data() {
    return {
      nums: [
      {
         on: 0
      },
      {
         on: 0
      },
      {
         on: 0
      },
      {
         on: 0
      },
      {
         on: 0
      },
    ]
    }
  },
  methods: {
    los(item) {
      item.on++
    }
  }
}

</script>

<style lang="scss" scoped>
.boxto {
  column-count: 2;
  column-gap: 10px;
  // display: flex;
  // justify-content: center;
  // flex-wrap: wrap;
  // justify-content: space-between;
  background: #eee;
  box-sizing: border-box;
  padding: 0 2%;
  font-size: 14px;

  .list_kr {
    position: relative;
    display: flex;
    justify-content: space-between;
    flex-direction: column;
    border-radius: 6px;
    overflow: hidden;
  }

  >div {
    background: #fff;
    // width: 49%;
    margin-bottom: 5%;

    .list_notes {
      font-size: 12px;
      color: green;
      border: 1px solid green;
      background: rgba(0, 128, 0, .1);
      border-radius: 2px;
    }

    .list_noto {
      font-size: 12px;
      color: red;
      border: 1px solid red;
      background: rgba(255, 0, 0, .1);
      border-radius: 2px;
    }

    .list_boon {
      font-size: 12px;
      color: #888;
      margin-left: 5px;
    }

    .list_boto {
      display: flex;
      justify-content: space-between;
      margin-top: 10px;



      .red {
        color: red;
      }

      .black {
        color: black;
      }
    }

    .list_borit {
      display: inline-block;
      width: 16px;
      height: 16px;
      font-size: 16px;
      line-height: 16px;
      border-radius: 8px;
      text-align: center;
      color: #fff;
      background: green;
      position: absolute;
      bottom: 5px;
      right: 5px;
    }
  }


}
</style>